package com.yixun.qfbao.controller;

import com.yixun.qfbao.api.service.ReportRelationService;
import com.yixun.qfbao.apidto.ReportRelationResDto;
import com.yixun.qfbao.request.BaseRequest;
import com.yixun.qfbao.request.GenericIdRequest;
import com.yixun.qfbao.response.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Controller
@ResponseBody
@RequestMapping("/tools")
public class ToolsController {

    @Autowired
    ReportRelationService reportRelationService;

    @PostMapping("/getReportRelation")
    public BaseResponse<ReportRelationResDto> getReportRelation(@RequestBody BaseRequest<GenericIdRequest> reqDto){
        BaseResponse<ReportRelationResDto> response = new BaseResponse<>();
        ReportRelationResDto resDto = reportRelationService.getReportRelation(reqDto.getData().getId());
        response.setData(resDto);
        return response;
    }

}
